package org.jeecg.modules.workorder.service;

import java.util.List;
import java.util.Map;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.workorder.entity.WorkingOrder;
import org.jeecg.modules.workorder.vo.OpenBomVO;
import org.jeecg.modules.workorder.vo.OpenWorkingOrderVO;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * @Description: 生产工单
 * @Date:   2021-09-09
 * @Version: V1.0
 */
public interface IWorkingOrderService extends IService<WorkingOrder> {

	/**根节点父ID的值*/
	public static final String ROOT_PID_VALUE = "0";
	
	/**树节点有子节点状态值*/
	public static final String HASCHILD = "1";
	
	/**树节点无子节点状态值*/
	public static final String NOCHILD = "0";

	/**新增节点*/
	void addWorkingOrder(WorkingOrder workingOrder);
	
	/**修改节点*/
	void updateWorkingOrder(WorkingOrder workingOrder) throws JeecgBootException;
	
	/**删除节点*/
	void deleteWorkingOrder(String id) throws JeecgBootException;

	/**查询生产工单数据，无分页*/
    List<WorkingOrder> queryTreeListNoPage(QueryWrapper<WorkingOrder> queryWrapper);

    /**通过订单id查询拟生成的开单单列表*/
	List<OpenWorkingOrderVO> queryOpenListByOrderId(String orderId,String styleId);

	/**通过订单id查询物料分析列表*/
	List<OpenBomVO> queryBomListByOrderId(String orderId,String styleId);
	
	/**合并工单*/
	Result<?> mergeByIds(List<String> ids, LoginUser loginUser);

	/**通过订单id获取下一拆分页*/
	String getNextStartPn(String orderInfoId);

	/**查询生产工单数据，分页*/
	IPage<WorkingOrder> page(Page<WorkingOrder> page, QueryWrapper<WorkingOrder> queryWrapper);

	/**通过工单号查询*/
	Map<String,String> queryByWorknum(String workNum);

}
